import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { Toast } from 'vant';
Vue.config.productionTip = false
//导入全部ui组件
import Vant from'vant'
//导入组件的样式
import 'vant/lib/index.css';
//构造函数加载组件
Vue.use(Vant)

// 导入axios组件
import axios from 'axios'
//设置默认的请求地址
axios.defaults.baseURL = 'http://www.young1024.com:1234';
let toast= null;
axios.interceptors.request.use((config)=>{
  toast = Toast.loading({
    message: '加载中...',
    duration: 0
  });
  return config;
})
axios.interceptors.response.use((res)=>{
  toast.clear()
  return res.data
})
//挂载到vue实例中
Vue.prototype.$http = axios;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
